/**
 * Created with PyCharm.
 * User: Wouker
 * Date: 15/08/13
 * Time: 11:15
 * To change this template use File | Settings | File Templates.
 */
$(document).ready(function(){

    $(".moneyfield").each(function(){
		var input = $( this );

		input.maskMoney({symbol:'R$ ', thousands:'.', decimal:',', symbolStay: true});
		input.trigger( 'mask' );
	});

    var masks = [
        { 'class': 'cpffield', 'mask': "999.999.999-99" },
        { 'class': 'cnpjfield', 'mask': "99.999.999/9999-99" },
        { 'class': 'telephonefield', 'mask': "(99) 9999-9999" }
    ];

    for ( var i in masks ) {
        var item = masks[ i ];
        var mask = item[ 'mask' ];
        var input = $( "." + item[ 'class' ]);

        input.mask( item[ 'mask' ] );
        input.focus();
    }

    //$(".telephonefield").each(function(){
	//	var input = $( this );
	//	input.mask("(99) 9999-9999");
	//	input.focus();
	//});

});